<script type="text/javascript" src="<?=APPLICATION_SITEADMIN_URL?>fckeditor/fckeditor.js"></script>
<script type="text/javascript" src="<?=APPLICATION_SITEADMIN_URL?>fckeditor/ewp.js"></script>
<script type="text/javascript">

	_width_multiplier = 16;
	_height_multiplier = 30;
	var EW_DHTMLEditors = [];
	function EW_UpdateTextArea() {
		if (typeof EW_DHTMLEditors != 'undefined') {
			if (FCKeditorAPI) {
				var inst;			
				for (inst in FCKeditorAPI.__Instances)
					FCKeditorAPI.__Instances[inst].UpdateLinkedField();
			}
		}
	}


</script>


<?
	$id = 0;
	$table = "tip_item";
	$mod = $_GET['mod'];
	$title_add = 'Add "Tip"';
	if(isset($_GET['id']))
	{
		$id = $_GET['id'];
		$db = new MySQL();
		$sql = $db->select("select * from $table where id='$id'");
		if ($db->numrows($sql)>0)	
		$te = $db->fetch($sql);
		$db->close();
		$title_add = 'Edit "Tip"';
	}
?>

<script type="text/JavaScript">
	function checkinput()
	{
		return true;
	}
	
	function save(id)
	{
		var frm=document.frmedit;		
		if(checkinput())
		{
			if(id==0)  frm.action="?mod=<?=$mod?>&act=process";
			else frm.action="?mod=<?=$mod?>&act=process&id="+id;
			frm.method="POST";
			frm.submit();
		}
	}
	
	function resetfrom()
	{
	   document.frmedit.reset();
	   
	}
</script>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
	  <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
		  <tr>
			<td width="34"><img src="<?=APPLICATION_SITEADMIN_URL?>images/cor_data_top_l.gif" alt="tl" width="34" height="19" /></td>
			<td class="toptborder">&nbsp;</td>
			<td width="20"><img src="<?=APPLICATION_SITEADMIN_URL?>images/cor_data_top_r.gif" alt="tr" /></td>
		  </tr>
	  </table></td>
	</tr>
	<tr>
	  <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
		  <tr>
			<td width="10" class="leftborder">&nbsp;</td>
			<td><table width="100%" border="0" cellpadding="0" cellspacing="2" class="dataBack">
			  <tr>
				<td width="55%" height="36" class="titleOrange"><?=$title_add?></td>
				<td align="right" valign="middle" class="titleOrange">&nbsp;</td>
			  </tr>
			  <tr>
				<td height="7" colspan="2" background="images/cor_data_line1.gif"></td>
			  </tr>
			  <tr>
				<form name="frmedit" method="post" enctype="multipart/form-data" >
				<td  colspan="2" ><table width="100%" border="0" cellspacing="0">				 
				  <tr>
				    <td width="19%" align="right" valign="top">Title : </td>
				    <td ><input name="title" type="text" class="form_0" value="<?=$te['title']?>" ></td>
				  </tr>		
				  	 
				  <tr>
				    <td align="right" valign="top">Title (Vietnamese) : </td>
				    <td ><input name="title_vn" type="text" class="form_0" value="<?=$te['title_vn']?>" ></td>
				  </tr>
				  
				  <tr>
					<td align="right" valign="top">Image (300px*200px): </td>
					<td ><input type="file" name="image" />
					<?php
						if($te['image']!="" && file_exists("../tip-img/".$te['image']))
						{
							echo '<br/><img src="../tip-img/'.$te['image'].'"  />';
						}
					?></td>
				  </tr> 
				  
				  <tr>
                                            <td align="right" valign="top">Description: </td>
                                            <td align="left" valign="middle">
                                                <SPAN class=hideTrigger><span id="aaaa" onClick="changeColor_02('aaaa')">English</span></SPAN>&nbsp;&nbsp;&nbsp;&nbsp;
                                                <SPAN class=hideTrigger><span id="bbbb" onClick="changeColor_02('bbbb')">Vietnamese</span></SPAN>&nbsp;&nbsp;&nbsp;&nbsp; 

                                                <DIV  class=hideBlock id="aaaa_s">
                                                    <P>
                                                        <textarea name="description" class="form_2"><?= $te['description'] ?></textarea>
                                                        <script type="text/javascript">
                                                            var editor = new EW_DHTMLEditor("description");
                                                            editor.create = function() {
                                                            var sBasePath = '<?= APPLICATION_SITEADMIN_URL ?>fckeditor/';
                                                            var oFCKeditor = new FCKeditor('description', 40*_width_multiplier, 5*_height_multiplier);
                                                            oFCKeditor.BasePath = sBasePath;
                                                            oFCKeditor.ReplaceTextarea();
                                                            this.active = true;
                                                            }
                                                            EW_DHTMLEditors[EW_DHTMLEditors.length] = editor;
                                                        </script>		
                                                    </P></DIV>


                                                <DIV  class=hideBlock id="bbbb_s">
                                                    <P>
                                                        <textarea name="description_vn" class="form_2"><?= $te['description_vn'] ?></textarea>
                                                        <script type="text/javascript">
                                                            var editor = new EW_DHTMLEditor("description_vn");
                                                            editor.create = function() {
                                                            var sBasePath = '<?= APPLICATION_SITEADMIN_URL ?>fckeditor/';
                                                            var oFCKeditor = new FCKeditor('description_vn', 40*_width_multiplier, 5*_height_multiplier);
                                                            oFCKeditor.BasePath = sBasePath;
                                                            oFCKeditor.ReplaceTextarea();
                                                            this.active = true;
                                                            }
                                                            EW_DHTMLEditors[EW_DHTMLEditors.length] = editor;
                                                        </script>					
                                                    </P>
                                                </DIV>					


                                                <script type="text/javascript">
                                                    changeColor_02('aaaa');
                                                </script>			
                                            </td>
                                        </tr>

                                        <tr>
                                            <td align="right" valign="top">Content: </td>
                                            <td align="left" valign="middle">
                                                <SPAN class=hideTrigger><span id="aaa" onClick="changeColor('aaa')">English</span></SPAN>&nbsp;&nbsp;&nbsp;&nbsp;
                                                <SPAN class=hideTrigger><span id="bbb" onClick="changeColor('bbb')">Vietnamese</span></SPAN>&nbsp;&nbsp;&nbsp;&nbsp;

                                                <DIV  class=hideBlock id="aaa_s">
                                                    <P>
                                                        <textarea name="content" class="form_2"><?= $te['content'] ?></textarea>
                                                        <script type="text/javascript">
                                                            var editor = new EW_DHTMLEditor("content");
                                                            editor.create = function() {
                                                            var sBasePath = '<?= APPLICATION_SITEADMIN_URL ?>fckeditor/';
                                                            var oFCKeditor = new FCKeditor('content', 40*_width_multiplier, 15*_height_multiplier);
                                                            oFCKeditor.BasePath = sBasePath;
                                                            oFCKeditor.ReplaceTextarea();
                                                            this.active = true;
                                                            }
                                                            EW_DHTMLEditors[EW_DHTMLEditors.length] = editor;
                                                        </script>		
                                                    </P></DIV>


                                                <DIV  class=hideBlock id="bbb_s">
                                                    <P>
                                                        <textarea name="content_vn" class="form_2"><?= $te['content_vn'] ?></textarea>
                                                        <script type="text/javascript">
                                                            var editor = new EW_DHTMLEditor("content_vn");
                                                            editor.create = function() {
                                                            var sBasePath = '<?= APPLICATION_SITEADMIN_URL ?>fckeditor/';
                                                            var oFCKeditor = new FCKeditor('content_vn', 40*_width_multiplier, 15*_height_multiplier);
                                                            oFCKeditor.BasePath = sBasePath;
                                                            oFCKeditor.ReplaceTextarea();
                                                            this.active = true;
                                                            }
                                                            EW_DHTMLEditors[EW_DHTMLEditors.length] = editor;
                                                        </script>					
                                                    </P>
                                                </DIV>					


                                                <script type="text/javascript">
                                                    changeColor('aaa');
                                                </script>
                                            </td>
                                        </tr>

				  <!--
				  <tr>
				    <td align="right" valign="top">Page Title : </td>
				    <td align="left" valign="middle">
					<textarea name="titlepage" class="form_3" ><?=$te['titlepage']?></textarea>					</td>
				  </tr> 
				  -->
				  
				  <tr>
				    <td align="right" valign="top">Keywords : </td>
				    <td align="left" valign="middle">
					<textarea name="meta_key" class="form_3" ><?=$te['meta_key']?></textarea>					</td>
				  </tr> 
				   <tr>
				    <td align="right" valign="top">Description : </td>
				    <td align="left" valign="middle">
					<textarea name="meta_des" class="form_3"><?=$te['meta_des']?></textarea>					</td>
				  </tr> 
				  
				  <tr>
					<td width="23%" height="35" align="right" valign="top">&nbsp;</td>
					<td align="left" valign="middle"><img src="images/icons/save.png" onClick="save(<?=$id?>);" class="pointer" />  &nbsp;
					<img src="images/icons/reset.png" onClick="resetfrom();" class="pointer" /></td>
				  </tr>
				</table>
				<input type="hidden" name="form_" value="edit">
				</td>
				</form>
			 </tr>
		   </table>
		   </td>
		   <td width="10" class="rightborder">&nbsp;</td>
		 </tr>
	  </table></td>
	</tr>
	<tr>
	  <td><table width="100%" border="0" cellpadding="0" cellspacing="0" class="dataBack">
		  <tr>
			<td width="34"><img src="<?=APPLICATION_SITEADMIN_URL?>images/cor_data_bot_l.gif" alt="bl" /></td>
			<td class="botborder" >&nbsp;</td>
			<td width="19"><img src="<?=APPLICATION_SITEADMIN_URL?>images/cor_data_bot_r.gif" alt="br" /></td>
		  </tr>
	  </table></td>
	</tr>
</table>
<script type="text/javascript">
<!--
	EW_createEditor();  // Create DHTML editor(s)

//-->
</script>

